import { createRouter, createWebHashHistory } from 'vue-router';
import { IParam } from '@core';

const routes = [
  {
    path: "/apps/:app?",
    beforeEnter: async (to: any, from: any) => {
      const appParams:IParam = {};
      const auth: Promise<any> = await App.initApp(appParams);
      return auth;
    },
    meta: {  
      tag: 'AppIndexView'
    },
    component: () => import("@views/base/app-index-view"),
    children: [
            {
              path: "complianceguides/:complianceguide?/views/complianceguideeditview",
              meta: {
                  tag:'ComplianceGuideEditView'
              },
              component: () => import("@views/compliance/compliance-guide-edit-view"),
            },
            {
              path: "complianceguides/:complianceguide?/views/complianceguidegridview",
              meta: {
                  tag:'ComplianceGuideGridView'
              },
              component: () => import("@views/compliance/compliance-guide-grid-view"),
            },
            {
              path: "complianceguides/:complianceguide?/views/complianceguideguideeditview",
              meta: {
                  tag:'ComplianceGuideGuideEditView'
              },
              component: () => import("@views/compliance/compliance-guide-guide-edit-view"),
            },
            {
              path: "lawsupports/:lawsupport?/views/lawsupportgridview",
              meta: {
                  tag:'LawSupportGridView'
              },
              component: () => import("@views/lawsupport/law-support-grid-view"),
            },
            {
              path: "lawsupports/:lawsupport?/views/lawsupportsupporteditview",
              meta: {
                  tag:'LawSupportSupportEditView'
              },
              component: () => import("@views/lawsupport/law-support-support-edit-view"),
            },
            {
              path: "lawsupports/:lawsupport?/views/lawsupporteditview",
              meta: {
                  tag:'LawSupportEditView'
              },
              component: () => import("@views/lawsupport/law-support-edit-view"),
            },
            {
              path: "lawpropagandizes/:lawpropagandize?/views/lawpropagandizegridview",
              meta: {
                  tag:'LawPropagandizeGridView'
              },
              component: () => import("@views/legaledu/law-propagandize-grid-view"),
            },
            {
              path: "lawpropagandizes/:lawpropagandize?/views/lawpropagandizeeditview",
              meta: {
                  tag:'LawPropagandizeEditView'
              },
              component: () => import("@views/legaledu/law-propagandize-edit-view"),
            },
            {
              path: "lawpropagandizes/:lawpropagandize?/views/lawpropagandizepropagandizeeditview",
              meta: {
                  tag:'LawPropagandizePropagandizeEditView'
              },
              component: () => import("@views/legaledu/law-propagandize-propagandize-edit-view"),
            },
            {
              path: "privatelegaldatashares/:privatelegaldatashare?/views/privatelegaldatasharegridview",
              meta: {
                  tag:'PrivateLegalDataShareGridView'
              },
              component: () => import("@views/legaledu/private-legal-data-share-grid-view"),
            },
            {
              path: "privatelegaldatashares/:privatelegaldatashare?/views/privatelegaldatashareeditview",
              meta: {
                  tag:'PrivateLegalDataShareEditView'
              },
              component: () => import("@views/legaledu/private-legal-data-share-edit-view"),
            },
            {
              path: "privatelegaldatashares/:privatelegaldatashare?/views/privatelegaldatashareshareeditview",
              meta: {
                  tag:'PrivateLegalDataShareShareEditView'
              },
              component: () => import("@views/legaledu/private-legal-data-share-share-edit-view"),
            },
            {
              path: "hotlawcases/:hotlawcase?/views/hotlawcasecaseeditview",
              meta: {
                  tag:'HotLawCaseCaseEditView'
              },
              component: () => import("@views/legaledu/hot-law-case-case-edit-view"),
            },
            {
              path: "hotlawcases/:hotlawcase?/views/hotlawcasegridview",
              meta: {
                  tag:'HotLawCaseGridView'
              },
              component: () => import("@views/legaledu/hot-law-case-grid-view"),
            },
            {
              path: "hotlawcases/:hotlawcase?/views/hotlawcaseeditview",
              meta: {
                  tag:'HotLawCaseEditView'
              },
              component: () => import("@views/legaledu/hot-law-case-edit-view"),
            },
            {
              path: "deptinterfaces/:deptinterface?/views/deptinterfaceeditview",
              meta: {
                  tag:'DeptInterfaceEditView'
              },
              component: () => import("@views/base/dept-interface-edit-view"),
            },
            {
              path: "deptinterfaces/:deptinterface?/views/deptinterfacegridview",
              meta: {
                  tag:'DeptInterfaceGridView'
              },
              component: () => import("@views/base/dept-interface-grid-view"),
            },
            {
              path: "sysroles/:sysrole?/views/sysrolegridview",
              meta: {
                  tag:'SysRoleGridView'
              },
              component: () => import("@views/rt/sys-role-grid-view"),
            },
            {
              path: "sysroles/:sysrole?/views/sysroleeditview",
              meta: {
                  tag:'SysRoleEditView'
              },
              component: () => import("@views/rt/sys-role-edit-view"),
            },
            {
              path: "sysemployees/:sysemployee?/sysuserroles/:sysuserrole?/views/sysuserroleeditview",
              meta: {
                  tag:'SysUserRoleEditView'
              },
              component: () => import("@views/rt/sys-user-role-edit-view"),
            },
            {
              path: "sysemployees/:sysemployee?/sysuserroles/:sysuserrole?/views/sysuserrolegridview",
              meta: {
                  tag:'SysUserRoleGridView'
              },
              component: () => import("@views/rt/sys-user-role-grid-view"),
            },
            {
              path: "sysroles/:sysrole?/sysuserroles/:sysuserrole?/views/sysuserroleeditview",
              meta: {
                  tag:'SysUserRoleEditView'
              },
              component: () => import("@views/rt/sys-user-role-edit-view"),
            },
            {
              path: "sysroles/:sysrole?/sysuserroles/:sysuserrole?/views/sysuserrolegridview",
              meta: {
                  tag:'SysUserRoleGridView'
              },
              component: () => import("@views/rt/sys-user-role-grid-view"),
            },
            {
              path: "systodos/:systodo?/views/systodotodogridview",
              meta: {
                  tag:'SysTodoTodoGridView'
              },
              component: () => import("@views/rt/sys-todo-todo-grid-view"),
            },
            {
              path: "systodos/:systodo?/views/systodoeditview",
              meta: {
                  tag:'SysTodoEditView'
              },
              component: () => import("@views/rt/sys-todo-edit-view"),
            },
            {
              path: "systodos/:systodo?/views/systodounsubmitgridview",
              meta: {
                  tag:'SysTodoUnSubmitGridView'
              },
              component: () => import("@views/rt/sys-todo-un-submit-grid-view"),
            },
            {
              path: "systodos/:systodo?/views/systododonegridview",
              meta: {
                  tag:'SysTodoDoneGridView'
              },
              component: () => import("@views/rt/sys-todo-done-grid-view"),
            },
            {
              path: "systodos/:systodo?/views/systodofinishgridview",
              meta: {
                  tag:'SysTodoFinishGridView'
              },
              component: () => import("@views/rt/sys-todo-finish-grid-view"),
            },
            {
              path: "systodos/:systodo?/views/systodogridview",
              meta: {
                  tag:'SysTodoGridView'
              },
              component: () => import("@views/rt/sys-todo-grid-view"),
            },
            {
              path: "lawexpresses/:lawexpress?/views/lawexpressexpresseditview",
              meta: {
                  tag:'LawExpressExpressEditView'
              },
              component: () => import("@views/legaledu/law-express-express-edit-view"),
            },
            {
              path: "lawexpresses/:lawexpress?/views/lawexpresseditview",
              meta: {
                  tag:'LawExpressEditView'
              },
              component: () => import("@views/legaledu/law-express-edit-view"),
            },
            {
              path: "lawexpresses/:lawexpress?/views/lawexpressgridview",
              meta: {
                  tag:'LawExpressGridView'
              },
              component: () => import("@views/legaledu/law-express-grid-view"),
            },
            {
              path: "complianceissues/:complianceissue?/views/complianceissueissueeditview",
              meta: {
                  tag:'ComplianceIssueIssueEditView'
              },
              component: () => import("@views/compliance/compliance-issue-issue-edit-view"),
            },
            {
              path: "complianceissues/:complianceissue?/views/complianceissuegridview",
              meta: {
                  tag:'ComplianceIssueGridView'
              },
              component: () => import("@views/compliance/compliance-issue-grid-view"),
            },
            {
              path: "complianceissues/:complianceissue?/views/complianceissueeditview",
              meta: {
                  tag:'ComplianceIssueEditView'
              },
              component: () => import("@views/compliance/compliance-issue-edit-view"),
            },
                {
                  path: "views/initiateindexview",
                  meta: {
                      tag:'InitiateIndexView'
                  },
                  component: () => import("@views/ungroup/initiate-index-view"),
                },
    ]
  },
  {
    path: "/",
    redirect: "/apps/lsapp"
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@components/common/404.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import("@components/common/login.vue")
  },
  {
    path: '/lock',
    name: 'lock',
    component: () => import('@components/common/lock.vue'),
  },
  {
    path: '/:pathMatch(.*)',
    redirect: '/404'
  },
]
const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

/**
 * 全局路由守卫
 */
router.beforeEach((to, from, next) => {
  next();
})
export default router;